//
//  ZYAddStrongCouseController.m
//  优学荟管理系统
//
//  Created by edz on 2017/10/25.
//  Copyright © 2017年 星道三好. All rights reserved.
//

#import "ZYAddStrongCouseController.h"
#import "ZYAddStrongCouseCell.h"
#define kCell @"cell"
#import "ZYBigCourseModel.h"
#import "ZYBigCourseTowModel.h"
#import "ZYBigCourseThreeModel.h"
#import "ZYDatePickerView.h"
#import "ZYLMultiselectView.h"
#import "ZYCurriculumMajorCategoryView.h"
#import "HNPickView.h"
#import "HNRegion.h"
#import "HNCourseListChartsModel.h"
#import "HMStrongBigCategoryView.h"
#import "HMStrongBigCategoryModel.h"
#define kCelll @"celll"
@interface ZYAddStrongCouseController ()<UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate,ZYDatePickerViewDelegate>

@property (nonatomic,strong) UITableView *tableView;
@property (nonatomic,strong) UIView *allView;

@property (nonatomic,strong) NSMutableArray *dataSource;
@property (nonatomic,strong) NSMutableArray *dataSourceTow;
@property (nonatomic,strong) NSMutableArray *dataSourceThree;
@property (nonatomic,strong) ZYBigCourseModel *model;
@property (nonatomic,strong) ZYBigCourseTowModel *modelTow;
@property (nonatomic,strong) ZYBigCourseThreeModel *modelThree;
@property (nonatomic,strong) ZYDatePickerView *datePickerView;
@property(nonatomic,copy) NSString *strongBigID;//加强要素ID
@property (nonatomic,copy)NSString *bigID;//大课ID
@property (nonatomic,copy)NSString *smallID;//小课ID
@property (nonatomic,copy)NSString *ID;//模板ID
@property (nonatomic,assign) NSInteger tag;
@property (nonatomic, strong) NSDate *stareDate;
@property (nonatomic, copy) NSString *creatStartTime;

/** 地址选择器 */
@property (nonatomic, strong) HNPickView *PickView;
/** 地区文件 */
@property (nonatomic, strong) HNRegion *Region;

/** 省份代码 */
@property (nonatomic, strong) NSNumber *provinceNumber;
/** 城市代码 */
@property (nonatomic, strong) NSNumber *cityNumber;
/** 县区代码 */
@property (nonatomic, strong) NSNumber *areaNumber;
@property (nonatomic,copy) NSString *smallTwoID;



@property (nonatomic,strong) NSMutableArray *dataArray;
@property (nonatomic,strong) HNCourseListChartsModel *hnmodel;
@property (nonatomic, strong) NSMutableArray *dataUserArray;//要素的数据源
@property (nonatomic, copy) NSString *selectUserId;//要素id
@property (nonatomic,strong) NSDictionary *dictCode;



@property(nonatomic,strong) UILabel *strongCouseBigLabel;//加强课大类目
@property (nonatomic,strong) UILabel *couseBigLabel;//课程大类目
@property (nonatomic,strong) UILabel *couseSmallLabel;//课程小类目
@property (nonatomic,strong) UILabel *openCouseNameLabel;//开课名称
@property (nonatomic,strong) UILabel *couseBeginLabel;//课程开始时间
@property (nonatomic,strong) UILabel *couseEndLabel;//课程结束时间
@property (nonatomic,strong) UILabel *couseIngLabel;//上课时间
@property (nonatomic,strong) UILabel *couseTimeLabel;//课程总次数
@property (nonatomic,strong) UILabel *countLabel;//报名人数


//点击事件
@property(nonatomic,strong) UIButton *strongCouseBigButton;//请选择加强课大类目
@property (nonatomic,strong) UIButton *couseBigButton;//请选择大类目
@property (nonatomic,strong) UIButton *couseSmallButton;//请选择小类目
@property (nonatomic,strong) UIButton *beginTimeButton;//开始选择课程时间
@property (nonatomic,strong) UIButton *endTimeButton;//结束选择课程时间
@property (nonatomic,strong) UIButton *couseTimeButton;//上课时间
@property (nonatomic,strong) UIButton *provinceButton;//省选择
@property (nonatomic,strong) UIButton *cityButton;//市选择
@property (nonatomic,strong) UIButton *areaButton;//区选择
@property (nonatomic,strong) UIButton *talkTempletButton;//模板选择







@property (nonatomic,strong) UILabel *provinceLabel;//省份
@property (nonatomic,strong) UILabel *cityLabel;//市
@property (nonatomic,strong) UILabel *areaLabel;//区
@property (nonatomic,strong) UILabel *streetLabel;//街道
@property (nonatomic,strong) UILabel *classRoomLabel;//上课教室




@property (nonatomic,strong) UILabel *talkTempletLabel;//评论模板
@property (nonatomic,strong) UILabel *registrationFeeLabel;//报名费用
@property (nonatomic,strong) UILabel *starLabel;//星币抵扣
@property (nonatomic,strong) UILabel *couseIntroductionLabel;//课程简介




//输入
@property (nonatomic,strong) UILabel *openTextField;
@property (nonatomic,strong) UITextField *timeTextField;
@property (nonatomic,strong) UITextField *countTextField;
@property (nonatomic,strong) UITextField *streetTextField;
@property (nonatomic,strong) UITextField *classRoomTextField;
@property (nonatomic,strong) UITextField *freeTextField;
@property (nonatomic,strong) UITextField *starTextField;
@property (nonatomic,strong) UITextView *couseInTextView;






//赋值
@property (nonatomic,strong) UILabel *zeroName;
@property (nonatomic,strong) UILabel *oneName;
@property (nonatomic,strong) UILabel *towName;
@property (nonatomic,strong) UILabel *threeName;
@property (nonatomic,strong) UILabel *fourName;
@property (nonatomic,strong) UILabel *fiveName;
@property (nonatomic,strong) UILabel *sixName;
@property (nonatomic,strong) UILabel *sevenName;
@property (nonatomic,strong) UILabel *eightName;
@property (nonatomic,strong) UILabel *nineName;


@property (nonatomic,strong) UILabel *smallTowsLabel;

@property (nonatomic,copy) NSString *couseNameStr;

@property (nonatomic,strong) UIButton *zySureButton;

@property (nonatomic,assign) BOOL isSSS;
@property (nonatomic,assign) BOOL isTow;
@property (nonatomic,assign) BOOL isThree;

@property (nonatomic,strong) UILabel *displayPriceLabel;
@property (nonatomic,strong) UITextField *displayPriceTextField;


@end

@implementation ZYAddStrongCouseController



- (ZYDatePickerView *)datePickerView{
    if (_datePickerView == nil) {
        self.datePickerView = [[ZYDatePickerView alloc]initWithFrame:self.view.bounds type:UIDatePickerModeDateAndTime];
        self.datePickerView.delegate = self;
        self.datePickerView.optionalMinDate = [NSDate date];
    }
    return _datePickerView;
}

- (NSMutableArray *)dataUserArray{
    if (_dataUserArray == nil) {
        self.dataUserArray = [NSMutableArray array];
    }
    
    return _dataUserArray;
}
- (NSMutableArray *)dataSelectSource{
    
    if (_dataSelectSource == nil) {
        self.dataSelectSource = [NSMutableArray array];
    }
    
    return _dataSelectSource;
    
    
}

- (NSMutableArray *)dataArray{
    
    if (_dataArray == nil) {
        self.dataArray = [NSMutableArray array];
    }
    
    return _dataArray;
    
    
    
}




- (NSMutableArray *)dataSourceThree {
    
    if (_dataSourceThree == nil) {
        self.dataSourceThree = [NSMutableArray array];
    }
    
    return _dataSourceThree;
    
    
}



- (NSMutableArray *)dataSourceTow {
    
    if (_dataSource == nil) {
        self.dataSourceTow = [NSMutableArray array];
    }
    
    return _dataSourceTow;
    
    
}



- (NSMutableArray *)dataSource {
    
    if (_dataSource == nil) {
        self.dataSource = [NSMutableArray array];
    }
    
    return _dataSource;
    
    
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = self.titleName;
    self.view.backgroundColor = [UIColor whiteColor];
    [self setNetAddWork];
    
    
    
}

- (void)setUpSuperView{
    
    
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0,kScreenWidth, kScreenHeight - 64) style:(UITableViewStyleGrouped)];
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    self.tableView.estimatedRowHeight = 200;
    [self.view addSubview:self.tableView];
    
    self.allView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, 1100 + 30 + 50)];
    
    self.allView.backgroundColor = [UIColor whiteColor];
    self.tableView.tableHeaderView = self.allView;
    
    
    [self.tableView registerClass:[ZYAddStrongCouseCell class] forCellReuseIdentifier:kCell];
    
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kCelll];
    
    [self setUpAllSuperView];
    
    
    
    
    
}








- (void)setUpAllSuperView{
    
    //加强课大类目
    self.strongCouseBigLabel = [UILabel new];
    self.strongCouseBigLabel.font = [UIFont systemFontOfSize:14];
    self.strongCouseBigLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.strongCouseBigLabel];
    
    //    @property (nonatomic,strong) UILabel *couseBigLabel;//课程大类目
    
    self.couseBigLabel = [UILabel new];
    self.couseBigLabel.font = [UIFont systemFontOfSize:14];
    self.couseBigLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.couseBigLabel];
    
    
    
    
    //    @property (nonatomic,strong) UILabel *couseSmallLabel;//课程小类目
    
    self.couseSmallLabel = [UILabel new];
    self.couseSmallLabel.font = [UIFont systemFontOfSize:14];
    self.couseSmallLabel.textColor = ColorRGB(0, 0, 0);
    
    [self.allView addSubview:self.couseSmallLabel];
    
    //    @property (nonatomic,strong) UILabel *openCouseNameLabel;//开课名称
    
    self.openCouseNameLabel = [UILabel new];
    self.openCouseNameLabel.font = [UIFont systemFontOfSize:14];
    self.openCouseNameLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.openCouseNameLabel];
    
    
    //    @property (nonatomic,strong) UILabel *couseBeginLabel;//课程开始时间
    self.couseBeginLabel = [UILabel new];
    self.couseBeginLabel.font = [UIFont systemFontOfSize:14];
    self.couseBeginLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.couseBeginLabel];
    
    //    @property (nonatomic,strong) UILabel *couseEndLabel;//课程结束时间
    
    self.couseEndLabel = [UILabel new];
    self.couseEndLabel.font = [UIFont systemFontOfSize:14];
    self.couseEndLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.couseEndLabel];
    
    
    
    //    @property (nonatomic,strong) UILabel *couseIngLabel;//上课时间
    
    self.couseIngLabel = [UILabel new];
    self.couseIngLabel.font = [UIFont systemFontOfSize:14];
    self.couseIngLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.couseIngLabel];
    
    //    @property (nonatomic,strong) UILabel *couseTimeLabel;//课程总次数
    
    self.couseTimeLabel = [UILabel new];
    self.couseTimeLabel.font = [UIFont systemFontOfSize:14];
    self.couseTimeLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.couseTimeLabel];
    //    @property (nonatomic,strong) UILabel *countLabel;//报名人数
    self.countLabel = [UILabel new];
    self.countLabel.font = [UIFont systemFontOfSize:14];
    self.countLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.countLabel];
    
    
    
    
    
    //    @property (nonatomic,strong) UILabel *provinceLabel;//省份
    
    
    self.provinceLabel = [UILabel new];
    self.provinceLabel.font = [UIFont systemFontOfSize:14];
    self.provinceLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.provinceLabel];
    
    
    self.provinceNumber =  [self.dictCode valueForKey:@"provinceid"];
    
    
    
    
    //    @property (nonatomic,strong) UILabel *cityLabel;//市
    
    self.cityLabel = [UILabel new];
    self.cityLabel.font = [UIFont systemFontOfSize:14];
    self.cityLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.cityLabel];
    
    
    //    @property (nonatomic,strong) UILabel *areaLabel;//区
    
    self.areaLabel = [UILabel new];
    self.areaLabel.font = [UIFont systemFontOfSize:14];
    self.areaLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.areaLabel];
    
    
    
    
    
    
    
    //    @property (nonatomic,strong) UILabel *streetLabel;//街道
    
    self.streetLabel = [UILabel new];
    self.streetLabel.font = [UIFont systemFontOfSize:14];
    self.streetLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.streetLabel];
    
    
    //    @property (nonatomic,strong) UILabel *classRoomLabel;//上课教室
    
    self.classRoomLabel = [UILabel new];
    self.classRoomLabel.font = [UIFont systemFontOfSize:14];
    self.classRoomLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.classRoomLabel];
    //
    
    
    
    
    
    
    
    
    //    @property (nonatomic,strong) UILabel *talkTempletLabel;//评论模板
    
    self.talkTempletLabel = [UILabel new];
    self.talkTempletLabel.font = [UIFont systemFontOfSize:14];
    self.talkTempletLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.talkTempletLabel];
    
    
    self.displayPriceLabel = [UILabel new];
    self.displayPriceLabel.font = [UIFont systemFontOfSize:14];
    self.displayPriceLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.displayPriceLabel];
    
    
    
    self.displayPriceTextField = [UITextField new];
    self.displayPriceTextField.textColor = ColorRGB(51, 51, 51);
    self.displayPriceTextField.keyboardType = UIKeyboardTypeDecimalPad;
    self.displayPriceTextField.font = [UIFont systemFontOfSize:11];
    [self.allView addSubview:self.displayPriceTextField];
    
    
    
    
    
    
    //    @property (nonatomic,strong) UILabel *registrationFeeLabel;//报名费用
    
    self.registrationFeeLabel = [UILabel new];
    self.registrationFeeLabel.font = [UIFont systemFontOfSize:14];
    self.registrationFeeLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.registrationFeeLabel];
    
    
    //    @property (nonatomic,strong) UILabel *starLabel;//星币抵扣
    
    self.starLabel = [UILabel new];
    self.starLabel.font = [UIFont systemFontOfSize:14];
    self.starLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.starLabel];
    
    
    
    
    //    @property (nonatomic,strong) UILabel *couseIntroductionLabel;//课程简介
    
    self.couseIntroductionLabel = [UILabel new];
    self.couseIntroductionLabel.font = [UIFont systemFontOfSize:14];
    self.couseIntroductionLabel.textColor = ColorRGB(0, 0, 0);
    [self.allView addSubview:self.couseIntroductionLabel];
    //
    
    
    /*########################点击事件###########################################*/
    
    
    self.strongCouseBigButton =[UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.strongCouseBigButton setTitle:@"请选择  >" forState:UIControlStateNormal];
    self.strongCouseBigButton.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.strongCouseBigButton setTitleColor:ColorRGB(153, 153, 153) forState:(UIControlStateNormal)];
    [self.allView addSubview:self.strongCouseBigButton];
    //    @property (nonatomic,strong) UIButton *couseBigButton;//请选择大类目
    self.couseBigButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.couseBigButton setTitle:@"请选择  >" forState:(UIControlStateNormal)];
    self.couseBigButton.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.couseBigButton setTitleColor:ColorRGB(153, 153, 153) forState:(UIControlStateNormal)];
    [self.allView addSubview:self.couseBigButton];
    //    @property (nonatomic,strong) UIButton *couseSmallButton;//请选择小类目
    self.couseSmallButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.couseSmallButton setTitle:@"请选择  >" forState:(UIControlStateNormal)];
    self.couseSmallButton.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.couseSmallButton setTitleColor:ColorRGB(153, 153, 153) forState:(UIControlStateNormal)];
    [self.allView addSubview:self.couseSmallButton];
    //    @property (nonatomic,strong) UIButton *beginTimeButton;//开始选择课程时间
    self.beginTimeButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.beginTimeButton setTitle:@"请选择  >" forState:(UIControlStateNormal)];
    self.beginTimeButton.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.beginTimeButton setTitleColor:ColorRGB(153, 153, 153) forState:(UIControlStateNormal)];
    [self.allView addSubview:self.beginTimeButton];
    //    @property (nonatomic,strong) UIButton *endTimeButton;//结束选择课程时间
    self.endTimeButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.endTimeButton setTitle:@"请选择  >" forState:(UIControlStateNormal)];
    self.endTimeButton.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.endTimeButton setTitleColor:ColorRGB(153, 153, 153) forState:(UIControlStateNormal)];
    [self.allView addSubview:self.endTimeButton];
    //    @property (nonatomic,strong) UIButton *couseTimeButton;//上课时间
    self.couseTimeButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.couseTimeButton setTitle:@"请选择  >" forState:(UIControlStateNormal)];
    self.couseTimeButton.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.couseTimeButton setTitleColor:ColorRGB(153, 153, 153) forState:(UIControlStateNormal)];
    [self.allView addSubview:self.couseTimeButton];
    //
    
    
    //    @property (nonatomic,strong) UIButton *provinceButton;//省选择
    self.provinceButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.provinceButton setTitle:@"请选择  >" forState:(UIControlStateNormal)];
    self.provinceButton.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.provinceButton setTitleColor:ColorRGB(153, 153, 153) forState:(UIControlStateNormal)];
    [self.allView addSubview:self.provinceButton];
    //    @property (nonatomic,strong) UIButton *cityButton;//市选择
    self.cityButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.cityButton setTitle:@"请选择  >" forState:(UIControlStateNormal)];
    self.cityButton.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.cityButton setTitleColor:ColorRGB(153, 153, 153) forState:(UIControlStateNormal)];
    [self.allView addSubview:self.cityButton];
    //    @property (nonatomic,strong) UIButton *areaButton;//区选择
    self.areaButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.areaButton setTitle:@"请选择  >" forState:(UIControlStateNormal)];
    self.areaButton.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.areaButton setTitleColor:ColorRGB(153, 153, 153) forState:(UIControlStateNormal)];
    [self.allView addSubview:self.areaButton];
    //    @property (nonatomic,strong) UIButton *talkTempletButton;//模板选择
    self.talkTempletButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.talkTempletButton setTitle:@"请选择  >" forState:(UIControlStateNormal)];
    self.talkTempletButton.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.talkTempletButton setTitleColor:ColorRGB(153, 153, 153) forState:(UIControlStateNormal)];
    [self.allView addSubview:self.talkTempletButton];
    //
    
    [self setMessaySuperView];
    
    
    
    
    
    //    @property (nonatomic,strong) UIButton *couseBigButton;//请选择大类目
    //    @property (nonatomic,strong) UIButton *couseSmallButton;//请选择小类目
    //    @property (nonatomic,strong) UIButton *beginTimeButton;//开始选择课程时间
    //    @property (nonatomic,strong) UIButton *endTimeButton;//结束选择课程时间
    //    @property (nonatomic,strong) UIButton *couseTimeButton;//上课时间
    //    @property (nonatomic,strong) UIButton *provinceButton;//省选择
    //    @property (nonatomic,strong) UIButton *cityButton;//市选择
    //    @property (nonatomic,strong) UIButton *areaButton;//区选择
    //    @property (nonatomic,strong) UIButton *talkTempletButton;//模板选择
    self.strongCouseBigButton.tag = 200;
    self.couseBigButton.tag = 201;
    self.couseSmallButton.tag = 202;
    self.beginTimeButton.tag = 203;
    self.endTimeButton.tag = 204;
    self.couseTimeButton.tag = 205;
    self.provinceButton.tag = 206;
    self.cityButton.tag = 207;
    self.areaButton.tag = 208;
    self.talkTempletButton.tag = 209;
    
    [self.strongCouseBigButton addTarget:self action:@selector(allButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.couseBigButton addTarget:self action:@selector(allButtonAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.couseSmallButton addTarget:self action:@selector(allButtonAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.beginTimeButton addTarget:self action:@selector(allButtonAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.endTimeButton addTarget:self action:@selector(allButtonAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.couseTimeButton addTarget:self action:@selector(allButtonAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.provinceButton addTarget:self action:@selector(allButtonAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.cityButton addTarget:self action:@selector(allButtonAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.areaButton addTarget:self action:@selector(allButtonAction:) forControlEvents:(UIControlEventTouchUpInside)];
    
    [self.talkTempletButton addTarget:self action:@selector(allButtonAction:) forControlEvents:(UIControlEventTouchUpInside)];
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}


- (void)setNetAddWork{
    //    http://192.168.0.113:8080/StarShine/ys/lesson.do?action=getLessonById&id={id}
    NSString *url = [NSString stringWithFormat:@"lesson.do?action=getLessonById&id=%@",self.lessionId];
    
    
    NSLog(@"%@ %@",LLBaseURL(url),[AccountTool shareAccountTool].currentAccount.authCode);
    
    [NetManager Get:LLBaseURL(url) Auth:YES Params:nil Success:^(id Obj) {
        
        
        if ([[Obj valueForKey:@"code"] integerValue] == 1000) {
            
            
            self.dictCode = [Obj valueForKey:@"t"];
            
            [self setUpSuperView];
            
        }
        
        
        
        
    } Fail:^(NSError *Error) {
        
        
    }];
    
    
    
    
    
}









- (void)setMessaySuperView{
    
    self.strongCouseBigLabel.text = @"加强课大类目";
    [self.strongCouseBigLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.offset(10);
    }];
    
    UILabel *grayZero = [UILabel new];
    grayZero.backgroundColor = ColorRGB(246, 246, 246);
    [self.allView addSubview:grayZero];
    
    [grayZero mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.strongCouseBigLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(1);
    }];
    
    
    
    self.couseBigLabel.text = @"课程大类目";
    [self.couseBigLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        //        make.left.top.offset(10);
        make.left.top.equalTo(grayZero).offset(10);
    }];
    
    UILabel *grayOne = [UILabel new];
    grayOne.backgroundColor = ColorRGB(246,246,246);
    [self.allView addSubview:grayOne];
    
    [grayOne mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.couseBigLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(1);
    }];
    
    
    self.couseSmallLabel.text = @"课程小类目";
    [self.couseSmallLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.couseBigLabel);
        make.top.equalTo(grayOne.mas_bottom).offset(10);
        
    }];
    
    UILabel *grayTow = [UILabel new];
    grayTow.backgroundColor = ColorRGB(246,246,246);
    [self.allView addSubview:grayTow];
    
    [grayTow mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.couseSmallLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(10);
    }];
    
    self.openCouseNameLabel.text = @"开课名称";
    [self.openCouseNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.couseSmallLabel);
        make.top.equalTo(grayTow.mas_bottom).offset(8);
        
    }];
    
    UILabel *grayThree= [UILabel new];
    grayThree.backgroundColor = ColorRGB(246,246,246);
    [self.allView addSubview:grayThree];
    
    [grayThree mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.openCouseNameLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(1);
    }];
    
    
    self.couseBeginLabel.text = @"课程开始时间";
    [self.couseBeginLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.openCouseNameLabel);
        make.top.equalTo(grayThree.mas_bottom).offset(10);
        
        
    }];
    
    
    
    UILabel *grayFour= [UILabel new];
    grayFour.backgroundColor = ColorRGB(246,246,246);
    [self.allView addSubview:grayFour];
    
    [grayFour mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.couseBeginLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(1);
    }];
    
    
    self.couseEndLabel.text = @"课程结束时间";
    [self.couseEndLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.couseBeginLabel);
        make.top.equalTo(grayFour.mas_bottom).offset(10);
        
    }];
    
    
    UILabel *grayFive = [UILabel new];
    grayFive.backgroundColor = ColorRGB(246,246,246);
    [self.allView addSubview:grayFive];
    
    [grayFive mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.couseEndLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(1);
    }];
    
    
    self.couseIngLabel.text = @"上课时间";
    [self.couseIngLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.couseEndLabel);
        make.top.equalTo(grayFive.mas_bottom).offset(10);
    }];
    
    
    UILabel *graySix = [UILabel new];
    graySix.backgroundColor =  ColorRGB(246,246,246);
    [self.allView addSubview:graySix];
    
    [graySix mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.couseIngLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(1);
    }];
    
    
    
    
    self.couseTimeLabel.text = @"课程总次数";
    [self.couseTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.couseIngLabel);
        make.top.equalTo(graySix.mas_bottom).offset(10);
    }];
    
    
    UILabel *graySeven = [UILabel new];
    graySeven.backgroundColor = ColorRGB(246,246,246);
    [self.allView addSubview:graySeven];
    
    [graySeven mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.couseTimeLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(1);
    }];
    
    
    self.countLabel.text = @"报名人数上限";
    [self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.couseTimeLabel);
        make.top.equalTo(graySeven.mas_bottom).offset(10);
    }];
    
    
    UILabel *grayEight = [UILabel new];
    grayEight.backgroundColor =  ColorRGB(246,246,246);
    [self.allView addSubview:grayEight];
    
    [grayEight mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.countLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(10);
    }];
    
    
    
    
    
    
    
    
    self.provinceLabel.text = @"上课地点（省份）";
    [self.provinceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.countLabel);
        make.top.equalTo(grayEight.mas_bottom).offset(10);
        
    }];
    
    
    
    UILabel *grayNine = [UILabel new];
    grayNine.backgroundColor = ColorRGB(246,246,246);
    [self.allView addSubview:grayNine];
    
    [grayNine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.provinceLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(1);
    }];
    
    
    self.cityLabel.text = @"市区";
    [self.cityLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.provinceLabel);
        make.top.equalTo(grayNine).offset(10);
        
        
    }];
    
    
    
    UILabel *grayTen = [UILabel new];
    grayTen.backgroundColor = ColorRGB(246,246,246);
    [self.allView addSubview:grayTen];
    
    [grayTen mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.cityLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(1);
    }];
    
    
    self.areaLabel.text = @"地区";
    [self.areaLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.cityLabel);
        make.top.equalTo(grayTen.mas_bottom).offset(10);
    }];
    
    
    UILabel *grayEleven = [UILabel new];
    grayEleven.backgroundColor = ColorRGB(246,246,246);
    [self.allView addSubview:grayEleven];
    
    [grayEleven mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.areaLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(1);
    }];
    
    
    
    self.streetLabel.text = @"街道地址";
    
    [self.streetLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.areaLabel);
        make.top.equalTo(grayEleven.mas_bottom).offset(10);
    }];
    
    
    UILabel *grayTwelve = [UILabel new];
    grayTwelve.backgroundColor = ColorRGB(246,246,246);
    [self.allView addSubview:grayTwelve];
    
    [grayTwelve mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.streetLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(1);
    }];
    
    
    self.classRoomLabel.text = @"上课课室";
    [self.classRoomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.streetLabel);
        make.top.equalTo(grayTwelve.mas_bottom).offset(10);
        
        
        
    }];
    
    
    UILabel *lineOne = [UILabel new];
    lineOne.backgroundColor = ColorRGB(246,246,246);
    [self.allView addSubview:lineOne];
    
    [lineOne mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.classRoomLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(10);
    }];
    
    
    
    
    
    
    
    self.talkTempletLabel.text = @"评论模板";
    [self.talkTempletLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.classRoomLabel);
        make.top.equalTo(lineOne.mas_bottom).offset(10);
        
    }];
    
    
    
    
    
    
    UILabel *lineTow = [UILabel new];
    lineTow.backgroundColor = ColorRGB(246,246,246);
    [self.allView addSubview:lineTow];
    
    [lineTow mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.talkTempletLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(1);
    }];
    
    
    
    self.displayPriceLabel.text = @"展示价";
    [self.displayPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.talkTempletLabel);
        make.top.equalTo(lineTow.mas_bottom).offset(10);
    }];
    
    [self.displayPriceTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.displayPriceLabel.mas_right).offset(20);
        make.centerY.equalTo(self.displayPriceLabel);
        make.width.offset(120);
    }];
    
    
    
    UILabel *lineThree = [UILabel new];
    lineThree.backgroundColor = ColorRGB(246,246,246);
    [self.allView addSubview:lineThree];
    
    [lineThree mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.displayPriceLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(1);
    }];
    
    
    
    
    
    
    self.registrationFeeLabel.text = @"报名费用";
    
    [self.registrationFeeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.displayPriceLabel);
        make.top.equalTo(lineThree.mas_bottom).offset(10);
    }];
    
    
    UILabel *zyLine = [UILabel new];
    zyLine.backgroundColor = ColorRGB(246,246,246);
    [self.allView addSubview:zyLine];
    
    [zyLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.registrationFeeLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(1);
    }];
    
    
    self.starLabel.text = @"星币抵扣";
    [self.starLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.registrationFeeLabel);
        make.top.equalTo(zyLine.mas_bottom).offset(10);
    }];
    
    UILabel *lineFour = [UILabel new];
    lineFour.backgroundColor = ColorRGB(246,246,246);
    [self.allView addSubview:lineFour];
    
    [lineFour mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.starLabel.mas_bottom).offset(10);
        make.width.offset(kScreenWidth);
        make.height.offset(1);
    }];
    
    
    self.couseIntroductionLabel.text = @"课程简介";
    [self.couseIntroductionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.starLabel);
        make.top.equalTo(lineFour.mas_bottom).offset(10);
    }];
    
    
    
    
    //    @property (nonatomic,strong) UIButton *couseBigButton;//请选择大类目
    //    @property (nonatomic,strong) UIButton *couseSmallButton;//请选择小类目
    //    @property (nonatomic,strong) UIButton *beginTimeButton;//开始选择课程时间
    //    @property (nonatomic,strong) UIButton *endTimeButton;//结束选择课程时间
    //    @property (nonatomic,strong) UIButton *couseTimeButton;//上课时间
    
    //    [self.couseBigButton mas_makeConstraints:^(MASConstraintMaker *make) {
    //
    //        make.right.equalTo(self.allView).offset(-10);
    //        make.top.centerY.equalTo(self.couseBigLabel);
    //
    //
    //    }];
    
    //    [self.couseSmallButton mas_makeConstraints:^(MASConstraintMaker *make) {
    //
    //        make.right.equalTo(self.allView).offset(-10);
    //        make.top.centerY.equalTo(self.couseSmallLabel);
    //
    //
    //    }];
    
    [self.strongCouseBigButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo (self.allView).offset(-10);
        make.top.centerY.equalTo(self.strongCouseBigLabel);
    }];
    
    
    [self.beginTimeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.equalTo(self.allView).offset(-10);
        make.top.centerY.equalTo(self.couseBeginLabel);
        
        
    }];
    
    
    
    [self.endTimeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.equalTo(self.allView).offset(-10);
        make.top.centerY.equalTo(self.couseEndLabel);
        
        
    }];
    
    
    [self.couseTimeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.equalTo(self.allView).offset(-10);
        make.top.centerY.equalTo(self.couseIngLabel);
        
        
    }];
    
    
    //    @property (nonatomic,strong) UIButton *provinceButton;//省选择
    //    @property (nonatomic,strong) UIButton *cityButton;//市选择
    //    @property (nonatomic,strong) UIButton *areaButton;//区选择
    //    @property (nonatomic,strong) UIButton *talkTempletButton;//模板选择
    //
    
    
    [self.provinceButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.equalTo(self.allView).offset(-10);
        make.top.centerY.equalTo(self.provinceLabel);
        
        
    }];
    [self.cityButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.equalTo(self.allView).offset(-10);
        make.top.centerY.equalTo(self.cityLabel);
        
        
    }];
    
    
    [self.areaButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.equalTo(self.allView).offset(-10);
        make.top.centerY.equalTo(self.areaLabel);
        
        
    }];
    
    
    //    [self.talkTempletButton mas_makeConstraints:^(MASConstraintMaker *make) {
    //
    //        make.right.equalTo(self.allView).offset(-10);
    //        make.top.centerY.equalTo(self.talkTempletLabel);
    //
    //
    //    }];
    
    
    
    
    
    
    
    
    
    
    self.openTextField = [UILabel new];
    self.openTextField.font = [UIFont systemFontOfSize:14];
    self.openTextField.textColor = ColorRGB(51,51,51);
    [self.allView addSubview:self.openTextField];
    
    
    
    [self.openTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.openCouseNameLabel.mas_right).offset(10);
        make.top.centerY.equalTo(self.openCouseNameLabel);
        make.width.offset(kScreenWidth - 100);
        
        
        
    }];
    
    
    
    
    
    //    @property (nonatomic,strong) UITextField *timeTextField;
    
    self.timeTextField = [UITextField new];
    self.timeTextField.placeholder = @"请输入课程总次数";
    self.timeTextField.textColor = ColorRGB(51, 51, 51);
    self.timeTextField.keyboardType = UIKeyboardTypeNumberPad;
    self.timeTextField.font = [UIFont systemFontOfSize:14];
    [self.allView addSubview:self.timeTextField];
    
    [self.timeTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.couseTimeLabel.mas_right).offset(10);
        make.top.centerY.equalTo(self.couseTimeLabel);
        make.width.offset(kScreenWidth - 100);
        
        
        
    }];
    
    
    
    //    @property (nonatomic,strong) UITextField *countTextField;
    self.countTextField = [UITextField new];
    self.countTextField.placeholder = @"请输入报名人数上限";
    self.countTextField.textColor = ColorRGB(51, 51, 51);
    self.countTextField.font = [UIFont systemFontOfSize:14];
    self.countTextField.keyboardType = UIKeyboardTypeNumberPad;
    [self.allView addSubview:self.countTextField];
    
    [self.countTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.countLabel.mas_right).offset(10);
        make.top.centerY.equalTo(self.countLabel);
        make.width.offset(kScreenWidth - 120);
        
        
        
    }];
    
    
    
    //    @property (nonatomic,strong) UITextField *streetTextField;
    
    self.streetTextField = [UITextField new];
    self.streetTextField.placeholder = @"请输入街道地址";
    self.streetTextField.textColor = ColorRGB(51, 51, 51);
    self.streetTextField.font = [UIFont systemFontOfSize:14];
    [self.allView addSubview:self.streetTextField];
    
    [self.streetTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.streetLabel.mas_right).offset(10);
        make.top.centerY.equalTo(self.streetLabel);
        make.width.offset(kScreenWidth - 100);
        
        
        
    }];
    
    //    @property (nonatomic,strong) UITextField *classRoomTextField;
    self.classRoomTextField = [UITextField new];
    self.classRoomTextField.placeholder = @"请输入上课课室";
    self.classRoomTextField.textColor = ColorRGB(51, 51, 51);
    self.classRoomTextField.font = [UIFont systemFontOfSize:14];
    [self.allView addSubview:self.classRoomTextField];
    
    [self.classRoomTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.classRoomLabel.mas_right).offset(10);
        make.top.centerY.equalTo(self.classRoomLabel);
        make.width.offset(kScreenWidth - 100);
        
        
        
    }];
    //    @property (nonatomic,strong) UITextField *freeTextField;
    self.freeTextField = [UITextField new];
    self.freeTextField.placeholder = @"请输入报名费用";
    self.freeTextField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
    self.freeTextField.textColor = ColorRGB(51, 51, 51);
    self.freeTextField.font = [UIFont systemFontOfSize:14];
    [self.allView addSubview:self.freeTextField];
    
    [self.freeTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.registrationFeeLabel.mas_right).offset(10);
        make.top.centerY.equalTo(self.registrationFeeLabel);
        make.width.offset(kScreenWidth - 100);
        
        
        
    }];
    //    @property (nonatomic,strong) UITextField *starTextField;
    self.starTextField = [UITextField new];
    self.starTextField.placeholder = @"请输入星币抵扣数";
    self.starTextField.textColor = ColorRGB(51, 51, 51);
    self.starTextField.keyboardType = UIKeyboardTypeNumberPad;
    self.starTextField.font = [UIFont systemFontOfSize:14];
    [self.allView addSubview:self.starTextField];
    
    [self.starTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.starLabel.mas_right).offset(10);
        make.top.centerY.equalTo(self.starLabel);
        make.width.offset(kScreenWidth - 100);
        
        
        
    }];
    
    
    
    
    self.couseInTextView = [UITextView new];
    self.couseInTextView.layer.borderWidth = 2;
    self.couseInTextView.layer.borderColor = [UIColor grayColor].CGColor;
    [self.allView addSubview:self.couseInTextView];
    
    [self.couseInTextView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.couseIntroductionLabel.mas_right).offset(5);
        make.top.equalTo(self.couseIntroductionLabel);
        make.width.offset(kScreenWidth - 100);
        make.height.offset(100);
        
    }];
    
    
    
    
    
    
    if (self.isUpTow) {
        
        self.zySureButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        [self.zySureButton setTitle:@"确定" forState:(UIControlStateNormal)];
        [self.zySureButton setTitleColor:ColorRGB(255, 254, 254) forState:(UIControlStateNormal)];
        [self.zySureButton setBackgroundImage:[UIImage imageNamed:@"圆角矩形-1"] forState:(UIControlStateNormal)];
        self.zySureButton.titleLabel.font = [UIFont systemFontOfSize:16];
        [self.zySureButton addTarget:self action:@selector(buttonAction) forControlEvents:(UIControlEventTouchUpInside)];
        self.zySureButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
        [self.allView addSubview:self.zySureButton];
        
        [self.zySureButton mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.top.equalTo(self.couseInTextView.mas_bottom).offset(15);
            make.centerX.equalTo(self.allView);
            
        }];
        
    }else{
        
        UILabel *threeLabel = [UILabel new];
        threeLabel.text = @"三好评价得优统计表";
        threeLabel.font = [UIFont systemFontOfSize:15];
        threeLabel.textColor = ColorRGB(51, 51, 51);
        threeLabel.textAlignment = NSTextAlignmentCenter;
        [self.allView addSubview:threeLabel];
        
        [threeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.offset(0);
            make.top.equalTo(self.couseInTextView.mas_bottom).offset(15);
            make.width.offset(kScreenWidth);
        }];
        
        
        
        // 柱状图对象
        PNBarChart * barChart = [[PNBarChart alloc]initWithFrame:CGRectMake(0,1100+50 - 180,SCREEN_WIDTH,200.0)];
        //X轴数据
        NSMutableArray *TitleArr = [NSMutableArray array];
        NSMutableArray *NumArr   = [NSMutableArray array];
        [self.dataSelectSource enumerateObjectsUsingBlock:^(HNCourseListChartsModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            [TitleArr addObject:obj.content];
            [NumArr addObject:obj.commentCount];
        }];
        
        for (NSInteger i=TitleArr.count; i<6; i++) {
            [TitleArr addObject:@""];
            [NumArr addObject:@0];
        }
        
        barChart.chartMarginTop = 12;
        barChart.chartMarginBottom = 24;
        
        barChart.isShowNumbers = NO;
        barChart.isGradientShow = YES;
        [barChart setXLabels:TitleArr];
        //Y轴数据
        [barChart setYValues:NumArr];
        // 是否显示柱图的数字
        barChart.isShowNumbers = NO;
        //开始描绘出来
        [barChart strokeChart];
        //加载在视图上
        [self.allView addSubview:barChart];
        
        
        
        
        
        
        
        
    }
    
    
    
    
    
    
    
    
    
    
    
    //赋值加强课大类目
    self.zeroName = [UILabel new];
    self.zeroName.font = [UIFont systemFontOfSize:14];
    self.zeroName.textColor = ColorRGB(51, 51, 51);
    [self.allView addSubview:self.zeroName];
    [self.zeroName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.strongCouseBigLabel.mas_right).offset(5);
        make.top.centerY.equalTo(self.strongCouseBigLabel);
        make.width.offset(kScreenWidth - 160);
    }];
    
    
    
    //课程大类目
    self.oneName = [UILabel new];
    self.oneName.font = [UIFont systemFontOfSize:14];
    self.oneName.textColor = ColorRGB(51, 51, 51);
    [self.allView addSubview:self.oneName];
    
    [self.oneName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.couseBigLabel.mas_right).offset(5);
        make.top.centerY.equalTo(self.couseBigLabel);
        make.width.offset(kScreenWidth - 160);
    }];
    
    
    
    //课程小类目
    self.towName = [UILabel new];
    self.towName.font = [UIFont systemFontOfSize:14];
    self.towName.textColor = ColorRGB(51, 51, 51);
    //    self.towName.backgroundColor = [UIColor redColor];
    [self.allView addSubview:self.towName];
    
    [self.towName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.couseSmallLabel.mas_right).offset(5);
        make.top.centerY.equalTo(self.couseSmallLabel);
        make.width.offset(100);
    }];
    
    
    
    
    self.smallTowsLabel = [UILabel new];
    self.smallTowsLabel.font = [UIFont systemFontOfSize:14];
    self.smallTowsLabel.textColor = ColorRGB(51, 51, 51);
    //    self.smallTowsLabel.backgroundColor = [UIColor greenColor];
    [self.allView addSubview:self.smallTowsLabel];
    
    
    [self.smallTowsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.towName.mas_right).offset(5);
        make.top.centerY.equalTo(self.towName);
        make.width.offset(100);
        
    }];
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    //课程开始时间
    self.threeName = [UILabel new];
    self.threeName.font = [UIFont systemFontOfSize:14];
    self.threeName.textColor = ColorRGB(51, 51, 51);
    [self.allView addSubview:self.threeName];
    
    [self.threeName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.couseBeginLabel.mas_right).offset(5);
        make.top.centerY.equalTo(self.couseBeginLabel);
        make.width.offset(kScreenWidth - 180);
    }];
    
    
    //课程结束时间
    self.fourName = [UILabel new];
    self.fourName.font = [UIFont systemFontOfSize:14];
    self.fourName.textColor = ColorRGB(51, 51, 51);
    [self.allView addSubview:self.fourName];
    
    [self.fourName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.couseEndLabel.mas_right).offset(5);
        make.top.centerY.equalTo(self.couseEndLabel);
        make.width.offset(kScreenWidth - 180);
    }];
    
    
    //上课时间
    self.fiveName = [UILabel new];
    self.fiveName.font = [UIFont systemFontOfSize:14];
    self.fiveName.textColor = ColorRGB(51, 51, 51);
    [self.allView addSubview:self.fiveName];
    
    [self.fiveName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.couseIngLabel.mas_right).offset(5);
        make.top.centerY.equalTo(self.couseIngLabel);
        make.width.offset(kScreenWidth - 150);
    }];
    
    
    
    //省份
    self.sixName = [UILabel new];
    //    self.sixName.backgroundColor = [UIColor redColor];
    self.sixName.font = [UIFont systemFontOfSize:14];
    self.sixName.textColor = ColorRGB(51, 51, 51);
    [self.allView addSubview:self.sixName];
    
    [self.sixName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.provinceLabel.mas_right).offset(5);
        make.top.centerY.equalTo(self.provinceLabel);
        make.width.offset(kScreenWidth - 200);
    }];
    
    //市区
    self.sevenName = [UILabel new];
    self.sevenName.font = [UIFont systemFontOfSize:14];
    self.sevenName.textColor = ColorRGB(51, 51, 51);
    [self.allView addSubview:self.sevenName];
    
    [self.sevenName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.cityLabel.mas_right).offset(5);
        make.top.centerY.equalTo(self.cityLabel);
        make.width.offset(kScreenWidth - 140);
    }];
    //地区
    self.eightName = [UILabel new];
    //    self.eightName.backgroundColor = [UIColor redColor];
    self.eightName.font = [UIFont systemFontOfSize:14];
    self.eightName.textColor = ColorRGB(51, 51, 51);
    [self.allView addSubview:self.eightName];
    
    [self.eightName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.areaLabel.mas_right).offset(5);
        make.top.centerY.equalTo(self.areaLabel);
        make.width.offset(kScreenWidth - 140);
    }];
    
    
    //评价模板
    self.nineName = [UILabel new];
    self.nineName.font = [UIFont systemFontOfSize:14];
    self.nineName.textColor = ColorRGB(51, 51, 51);
    [self.allView addSubview:self.nineName];
    
    [self.nineName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.talkTempletLabel.mas_right).offset(5);
        make.top.centerY.equalTo(self.talkTempletLabel);
        make.width.offset(kScreenWidth - 150);
    }];
    
    if ([NSString isBlankString:[self.dictCode valueForKey:@"reinforceCategoryName"]]) {
        
    } else {
        self.zeroName.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"reinforceCategoryName"]];
        self.strongBigID = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"reinforceCategoryId"]];
    }
    
    
    
    
    self.oneName.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"courseCategoryName"]];
    self.bigID = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"courseCategoryId"]];//课程大类目id
    
    
    
    if (![[self.dictCode valueForKey:@"smallIds"] isKindOfClass:[NSNull class]]) {
        NSArray *arr = [self.dictCode valueForKey:@"smallIds"];
        
        NSDictionary *dictOne = [arr firstObject];
        self.towName.text = [NSString stringWithFormat:@"%@",[dictOne valueForKey:@"categoryName"]];
        self.smallID = [NSString stringWithFormat:@"%@",[dictOne valueForKey:@"id"]];//课程小类目
        
        
        if (arr.count > 1) {
            
            dictOne = [arr lastObject];
            self.smallTowsLabel.text = [NSString stringWithFormat:@"%@",[dictOne valueForKey:@"categoryName"]];
            self.smallTwoID = [NSString stringWithFormat:@"%@",[dictOne valueForKey:@"id"]];
            
        }
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    if (self.isUpTeach) {
        self.openTextField.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"name"]];
        self.couseNameStr = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"name"]];
    }else{
        
        self.openTextField.text = [NSString stringWithFormat:@"%@(加强课)",[self.dictCode valueForKey:@"name"]];
        self.couseNameStr = [NSString stringWithFormat:@"%@(加强课)",[self.dictCode valueForKey:@"name"]];
    }
    
    
    
    
    
    self.nineName.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"templatename"]];
    self.ID = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"templateId"]];//模板id
    
    
    if (self.isUpTow) {
        self.threeName.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"startTime"]];
        self.fourName.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"endTime"]];
        
        self.fiveName.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"lessonTime"]];
        self.timeTextField.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"courseCount"]];
        
        
        
        self.timeTextField.userInteractionEnabled = NO;
        self.freeTextField.userInteractionEnabled = NO;
        self.starTextField.userInteractionEnabled = NO;
        self.countTextField.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"limitNum"]];
        self.sixName.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"provincename"]];
        self.sevenName.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"cityname"]];
        self.eightName.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"areaname"]];
        
        self.streetTextField.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"address"]];
        self.classRoomTextField.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"classroom"]];
#pragma mark - 赋值~~~~~~~~
        self.freeTextField.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"price"]];
        self.starTextField.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"coins"]];
        self.couseInTextView.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"description"]];
    } else {
        self.timeTextField.userInteractionEnabled = YES;
        self.freeTextField.userInteractionEnabled = YES;
        self.starTextField.userInteractionEnabled = YES;
    }
    
    
    self.displayPriceTextField.text = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"showPrice"]];
    
    
   
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}



#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    if (self.isUpTow) {
        
        return 0;
    }else{
        return self.dataSelectSource.count;
    }
    
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    
    if (self.isUpTow) {
        
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCelll forIndexPath:indexPath];
        
        return cell;
    }else{
        
        ZYAddStrongCouseCell *cell = [tableView dequeueReusableCellWithIdentifier:kCell forIndexPath:indexPath];
        
        
        
        
        
        if (self.dataSelectSource.count > indexPath.row) {
            
            
            
            HNCourseListChartsModel *model = self.dataSelectSource[indexPath.row];
            
            
            [cell setAssignByHNCourseListChartsModel:model];
            
            
            if ([self.dataArray containsObject:self.dataSelectSource[indexPath.row]]) {
                
                cell.selectButton.selected = YES;
                
            }else{
                
                cell.selectButton.selected = NO;
            }
            
            
            
        }
        
        
        
        
        return cell;
    }
    
    
    
    
    
}



- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    
    [self.timeTextField resignFirstResponder];
    [self.countTextField resignFirstResponder];
    [self.streetTextField resignFirstResponder];
    [self.classRoomTextField resignFirstResponder];
    [self.freeTextField resignFirstResponder];
    [self.starTextField resignFirstResponder];
    [self.couseInTextView resignFirstResponder];
    [self.displayPriceTextField resignFirstResponder];
    
    
    
    
    
    HNCourseListChartsModel *model = [self.dataSelectSource objectAtIndex:indexPath.row];
    if ([self.dataArray containsObject:self.dataSelectSource[indexPath.row]]) {
        [self.dataArray removeObject:self.dataSelectSource[indexPath.row]];
        [self.dataUserArray removeObject:self.selectUserId];
        
        
        
    }else {
        
        [self.dataArray addObject:self.dataSelectSource[indexPath.row]];
        
        
        self.selectUserId = [model.ID stringValue];
        [self.dataUserArray addObject:self.selectUserId];
        
        
        
    }
    
    
    [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
}




- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    
    if (self.isUpTow) {
        
        
        return 0.0f;
    }else{
        
        return 40;
    }
    
    
    
    
    
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    
    UIView *vv = [UIView new];
    if (self.isUpTow) {
        
        return vv;
    }else{
        
        
        
        UIButton *button = [UIButton buttonWithType:(UIButtonTypeCustom)];
        button.frame = CGRectMake(20, 5, kScreenWidth - 40, 30);
        [button setTitle:@"确定" forState:(UIControlStateNormal)];
        [button setTitleColor:ColorRGB(255, 254, 254) forState:(UIControlStateNormal)];
        [button setBackgroundImage:[UIImage imageNamed:@"圆角矩形-1"] forState:(UIControlStateNormal)];
        button.titleLabel.font = [UIFont systemFontOfSize:16];
        [button addTarget:self action:@selector(buttonAction) forControlEvents:(UIControlEventTouchUpInside)];
        [vv addSubview:button];
        
        
        return vv;
    }
    
    
    
}





- (HNPickView *)PickView
{
    if (!_PickView)
    {
        _PickView = [[[NSBundle mainBundle] loadNibNamed:[HNPickView description] owner:nil options:nil] lastObject];
        [[UIApplication sharedApplication].keyWindow.rootViewController.view addSubview:_PickView];
        [_PickView Config];
        __weak typeof(self)weakSelf = self;
        _PickView.PickViewBlock = ^(RegionType Type, NSInteger Index)
        {
            if (Type == HNPickViewProvice)
            {
                Provice *P = weakSelf.Region.Provices[Index];
                
                weakSelf.sixName.text = P.provincename;
                
                //                weakSelf.isSSS = NO;
                weakSelf.provinceNumber = P.provinceid;
                weakSelf.cityNumber = nil;
                weakSelf.sevenName.text = @"";
                weakSelf.areaNumber = nil;
                weakSelf.eightName.text = @"";
                
            }
            
            if (Type == HNPickViewCity) {
                
                City *C = weakSelf.Region.Cities[Index];
                
                weakSelf.sevenName.text = C.cityname;
                //                weakSelf.isSSS = NO;
                weakSelf.cityNumber = C.cityid;
                weakSelf.eightName.text =@"";
                weakSelf.areaNumber = nil;
                //                weakSelf.cell.area.text = @"";
                //                weakSelf.cell.areaNumber = nil;
            }
            
            if (Type == HNPickViewArea) {
                
                Area *A = weakSelf.Region.Areas[Index];
                weakSelf.eightName.text = A.areaname;
                //                weakSelf.isSSS = NO;
                
                weakSelf.areaNumber = A.areaid == nil ? @0:A.areaid;
            }
        };
    }
    return _PickView;
}

- (HNRegion *)Region
{
    if (!_Region)
    {
        _Region = [[HNRegion alloc] init];
        [_Region GetProvice];
    }
    return _Region;
}






#pragma mark ---选择方法的实现
- (void)allButtonAction:(UIButton *)sender{
    
    [self.timeTextField resignFirstResponder];
    [self.countTextField resignFirstResponder];
    [self.streetTextField resignFirstResponder];
    [self.classRoomTextField resignFirstResponder];
    [self.freeTextField resignFirstResponder];
    [self.starTextField resignFirstResponder];
    [self.couseInTextView resignFirstResponder];
    [self.displayPriceTextField resignFirstResponder];
    
    
    NSInteger tag = sender.tag;
    
    
    
    if (201 == tag) {//课程大类目
        
        //[self setNetWork];
        
        
    }else if (200 == tag){//加强课大类目
        
        //        [self setStrongBigNetWork];
        HMStrongBigCategoryView *view = [[[NSBundle mainBundle]loadNibNamed:@"HMStrongBigCategoryView" owner:nil options:nil]lastObject];
        view.frame = [UIApplication sharedApplication].keyWindow.bounds;
        [[UIApplication sharedApplication].keyWindow addSubview:view];
        __block typeof(self) weakSelf  = self;
        view.selectRowBlock = ^(HMStrongBigCategoryModel *model) {
            weakSelf.zeroName.text = [NSString stringWithFormat:@"%@",model.categoryName];
            weakSelf.strongBigID = model.Id;
        };
        
    }else if (202 == tag){//课程小类目
        
        if (self.bigID) {
            //[self setNetWorkTow];
            
        }else{
            
            NSLog(@"请先选择大类");
            [self createAlertViewWithTitle:nil message:@"请先选择大类" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
        }
    }else if (203 == tag){//课程开始时间
        self.tag = tag;
        self.datePickerView.title = @"课程开始时间";
        [self.datePickerView show];
        
    }else if (204 == tag){//课程结束时间
        self.tag = tag;
        self.datePickerView.title = @"课程结束时间";
        [self.datePickerView show];
        
    }else if (205 == tag){//上课时间
        self.tag  = tag;
        self.datePickerView.title = @"上课时间";
        [self.datePickerView show];
        
    }else if (206 == tag){//上课地点省份
        
        
        NSLog(@"dddd");
        self.isSSS = YES;
        [self.PickView Show:self.Region RegionType:(HNPickViewProvice)];
        
        
    }else if (207 == tag){//市区
        
        if (self.sixName.text.length == 0) {
            
            [self createAlertViewWithTitle:nil message:@"请先选择省份" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
        }else{
            
            [self.Region GetCityWithProvinceid:[self.provinceNumber integerValue]];
            [self.PickView Show:self.Region RegionType:(HNPickViewCity)];
        }
        
        
    }else if (208 == tag){//地区
        
        if (self.sevenName.text.length == 0) {
            [self createAlertViewWithTitle:nil message:@"请先选择城市" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
        }else{
            NSString *provinceid;
            NSString *city;
            NSString *areaid;
            
            if (self.isSSS) {
                provinceid = [NSString stringWithFormat:@"%@",self.provinceNumber];
                city = [NSString stringWithFormat:@"%@",self.cityNumber];
                areaid = [NSString stringWithFormat:@"%@",self.areaNumber];
                
            }else{
                provinceid = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"provinceid"]];
                city = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"cityid"]];
                areaid = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"areaid"]];
                
            }
         
            
//            if (self.isSSS) {
//                provinceid = [NSString stringWithFormat:@"%@",self.provinceNumber];
//                city = [NSString stringWithFormat:@"%@",self.cityNumber];
//                areaid = [NSString stringWithFormat:@"%@",self.areaNumber];
//
//            }else{
//                provinceid = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"provinceid"]];
//                city = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"cityid"]];
//                areaid = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"areaid"]];
//
//            }
            
            
            if (![self.cityNumber integerValue]) {
               
                self.cityNumber = [self.dictCode valueForKey:@"cityid"];
            }
            
            
            
            [self.Region GetAreaWithCityid:[self.cityNumber integerValue]];
            [self.PickView Show:self.Region RegionType:(HNPickViewArea)];
        }
        
        
    }else{//评论模板
        [self setNetWorkThree];
        
    }
    
    
    
    
    
    
    
    
    
    
    
    
}


#pragma mark --- 大类目接口
- (void)setNetWork{
    // http://192.168.0.113:8080/StarShine/ys/lesson.do?action=getBigCategory
    NSString *url = [NSString stringWithFormat:@"lesson.do?action=getBigCategory"];
    
    
    NSLog(@"%@ %@",LLBaseURL(url),[AccountTool shareAccountTool].currentAccount.authCode);
    
    [MBProgressHUD showHUD];
    
    [NetManager Get:LLBaseURL(url) Auth:YES Params:nil Success:^(id Obj) {
        [self.dataSource removeAllObjects];
        [MBProgressHUD hideHUD];
        if ([[Obj valueForKey:@"code"] integerValue] == 1000) {
            
            NSArray *arr = [Obj valueForKey:@"t"];
            
            for (NSDictionary *dict  in arr) {
                ZYBigCourseModel *model = [ZYBigCourseModel new];
                model.ID = [dict valueForKey:@"id"];
                [model setValuesForKeysWithDictionary:dict];
                [self.dataSource addObject:model];
            }
            
            
            [self.tableView reloadData];
            
            [self curriculumOne];
        }
        
        
        
    } Fail:^(NSError *Error) {
        [MBProgressHUD hideHUD];
        [MBProgressHUD showError:NetErr];
    }];
    
    
    
}

#pragma mark --- 大分类方法的实现
- (void)curriculumOne{
    
    [ZYCurriculumMajorCategoryView showWithTitle:@"请选择课程大类目" titles:self.dataSource zYBigCourseModel:self.model zYBigCourseTowModel:self.modelTow zYBigCourseThreeModel:self.modelThree selectIndex:^(NSInteger selectIndex) {
        NSLog(@"选择了第%ld个",selectIndex);
        
        
        
        self.bigID = [NSString stringWithFormat:@"%ld",(long)selectIndex];
        
        
        
    } selectValue:^(NSString *selectValue) {
        NSLog(@"选择的值为%@",selectValue);
        //        self.cell.courseBigCategory_Text.text = selectValue;
        //        self.cell.courseSmallCategory_Text.text = nil;
        self.oneName.text = selectValue;
        
        
    } showCloseButton:NO isUp:NO isUpAll:NO];
    
    
    
}


#pragma mark --- 小类目接口
- (void)setNetWorkTow{
    NSString *url = [NSString stringWithFormat:@"lesson.do?action=getSmallCategoryByBigId&bigId=%@",self.bigID];
    
    
    NSLog(@"%@ %@",LLBaseURL(url),[AccountTool shareAccountTool].currentAccount.authCode);
    [MBProgressHUD showHUD];
    [NetManager Get:LLBaseURL(url) Auth:YES Params:nil Success:^(id Obj) {
        [self.dataSourceTow removeAllObjects];
        [MBProgressHUD hideHUD];
        if ([[Obj valueForKey:@"code"] integerValue] == 1000) {
            
            NSArray *arr = [Obj valueForKey:@"t"];
            
            for (NSDictionary *dict  in arr) {
                ZYBigCourseTowModel *model = [ZYBigCourseTowModel new];
                model.ID = [dict valueForKey:@"id"];
                [model setValuesForKeysWithDictionary:dict];
                [self.dataSourceTow addObject:model];
                
            }
            
            
            [self.tableView reloadData];
            
            [self curriculumTow];
        }
        
        
        
    } Fail:^(NSError *Error) {
        [MBProgressHUD hideHUD];
        [MBProgressHUD showError:NetErr];
    }];
    
    
    
}

#pragma mark --- 小分类方法的实现
- (void)curriculumTow{
    
    
    
    
    
    //    ZYLMultiselectView *zyl = [[ZYLMultiselectView alloc]initWithFrame:CGRectMake(30, 50, kScreenWidth - 60, kScreenHeight - 150)];
    //    zyl.dataSource = self.dataSourceTow;
    //
    //    [self.view addSubview:zyl];
    //
    //
    //    zyl.selectBlock = ^(NSMutableArray *selectUserId,NSMutableArray *name) {
    //        self.towName.text = [name componentsJoinedByString:@","];
    //        self.smallTwoID = [selectUserId componentsJoinedByString:@","];
    //    };
    //
    //
    
    
    
    
    
    
    
    
    
}


#pragma mark- <WGBDatePickerViewDelegate>
//当时间改变时触发
- (void)changeTime:(NSDate *)date{
    // NSLog(@"代理监听更改时间为---%@",[self.datePickerView stringFromDate:date]);
}

//确定时间
- (void)determine:(NSDate *)date{
    
    
    //传这个就对了
    
    NSDate *towDate = [[NSDate alloc]init];
    
    if ( 203 == self.tag) {
        self.stareDate = date;
        self.creatStartTime = [NSString stringWithFormat:@"%@:%@",[self.datePickerView stringFromDate:date],@"00"];
        self.threeName.text = [self.datePickerView stringFromDate:date];
        
    }else if (204 == self.tag){
        towDate = date;
        if (self.threeName.text.length == 0) return [self  createAlertViewWithTitle:nil message:@"请先选择课程开课时间" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
        
        NSComparisonResult result = [self.stareDate compare:date];
        
        if (result != NSOrderedAscending) return
            [self createAlertViewWithTitle:nil message:@"课程结束时间必须大于课程开始时间" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
        self.creatStartTime = [NSString stringWithFormat:@"%@:%@",[self.datePickerView stringFromDate:date],@"00"];
        self.fourName.text = [self.datePickerView stringFromDate:date];
    }else if (205 == self.tag){
        
        if (self.fourName.text.length == 0)  return [self  createAlertViewWithTitle:nil message:@"请先选择课程结束时间" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
        
        NSComparisonResult result = [towDate compare:date];
        
        if (result != NSOrderedAscending) return
            [self createAlertViewWithTitle:nil message:@"上课时间必须小于课程结束时间" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
        self.creatStartTime = [NSString stringWithFormat:@"%@:%@",[self.datePickerView stringFromDate:date],@"00"];
        self.fiveName.text = [self.datePickerView stringFromDate:date];
        
    }
    
    
    NSLog(@"%@ %@",[self.datePickerView stringFromDate:date],self.creatStartTime);
}



#pragma mark --- 膜拜接口
- (void)setNetWorkThree{
    NSString *url = [NSString stringWithFormat:@"lesson.do?action=getTemplates"];
    
    
    NSLog(@"%@ %@",LLBaseURL(url),[AccountTool shareAccountTool].currentAccount.authCode);
    [MBProgressHUD showHUD];
    [NetManager Get:LLBaseURL(url) Auth:YES Params:nil Success:^(id Obj) {
        [self.dataSourceThree removeAllObjects];
        [MBProgressHUD hideHUD];
        if ([[Obj valueForKey:@"code"] integerValue] == 1000) {
            
            NSDictionary *t = [Obj valueForKey:@"t"];
            
            
            NSArray *arr = [t  valueForKey:@"dataList"];
            
            for (NSDictionary *dict  in arr) {
                ZYBigCourseThreeModel *model = [ZYBigCourseThreeModel new];
                model.ID = [dict valueForKey:@"id"];
                [model setValuesForKeysWithDictionary:dict];
                [self.dataSourceThree addObject:model];
            }
            [self.tableView reloadData];
            
            if (self.dataSourceThree.count != 0) {
                [self curriculumThree];
            }else{
                self.ID = @"0";
                [self createAlertViewWithTitle:nil message:@"没有数据" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
            }
            
            
        }
        
        
        
        
    } Fail:^(NSError *Error) {
        [MBProgressHUD hideHUD];
        [MBProgressHUD showError:NetErr];
    }];
    
    
    
}
#pragma mark --- 模板方法的实现
- (void)curriculumThree{
    [ZYCurriculumMajorCategoryView showWithTitle:@"请选择评价模板" titles:self.dataSourceThree zYBigCourseModel:self.model zYBigCourseTowModel:self.modelTow zYBigCourseThreeModel:self.modelThree selectIndex:^(NSInteger selectIndex) {
        NSLog(@"选择了第%ld个",selectIndex);
        self.ID = [NSString stringWithFormat:@"%ld",(long)selectIndex];
    } selectValue:^(NSString *selectValue) {
        NSLog(@"选择的值为%@",selectValue);
        self.nineName.text = selectValue;
        
        
    } showCloseButton:NO  isUp:NO isUpAll:YES];
    
    
    
}








#pragma mark ----确定方法的实现
- (void)buttonAction{
    
    
    
    NSMutableArray *smallCategory = [NSMutableArray array];
    self.smallID ? [smallCategory addObject:self.smallID]:nil;
    self.smallTwoID ? [smallCategory addObject:self.smallTwoID]:nil;
    NSString *categoryID = [smallCategory componentsJoinedByString:@","];
    
    NSString *userId = [self.dataUserArray componentsJoinedByString:@","];
    
    
    if (self.zeroName.text.length == 0) {
        
        [self createAlertViewWithTitle:nil message:@"请选择加强课大类目" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
    }else if (self.threeName.text.length == 0) {
        [self createAlertViewWithTitle:nil message:@"请输入课程开始时间" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
    }else if (self.fourName.text.length == 0){
        
        [self createAlertViewWithTitle:nil message:@"请输入课程结束时间" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
        
    }else if (self.fiveName.text.length == 0){
        
        [self createAlertViewWithTitle:nil message:@"请输入上课时间" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
    }else if (self.timeTextField.text.length == 0){
        
        [self createAlertViewWithTitle:nil message:@"请输入课程总次数" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
    }else if (self.countTextField.text.length == 0){
        
        [self createAlertViewWithTitle:nil message:@"请输入报名人数上限" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
    }else if (self.sixName.text.length == 0){
        
        [self createAlertViewWithTitle:nil message:@"请输入省份" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
    }else if (self.sevenName.text.length == 0){
        
        [self createAlertViewWithTitle:nil message:@"请输入市区" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
        
    }else if (self.eightName.text.length == 0){
        [self createAlertViewWithTitle:nil message:@"请输入地区" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
        
        
    }else if (self.streetTextField.text.length == 0){
        
        [self createAlertViewWithTitle:nil message:@"请输入街道地址" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
    }else if (self.classRoomTextField.text.length == 0){
        [self createAlertViewWithTitle:nil message:@"请输入上课课室" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
    }else if (self.freeTextField.text.length == 0){
        
        [self createAlertViewWithTitle:nil message:@"请输入报名费用" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
    }else if (self.starTextField.text.length == 0){
        
        [self createAlertViewWithTitle:nil message:@"请输入星币抵扣数" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
    }else if (self.couseInTextView.text.length == 0){
        
        [self createAlertViewWithTitle:nil message:@"请输入课程简介" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
    }else if (userId.length == 0){
        
        if (self.isUpTow) {
            double coins = [self.starTextField.text doubleValue];
            double sum = [self.freeTextField.text doubleValue];
            
            double sumMoney = 0;
            double coninsStar = 0;
            if (sum *0.05  >= 200) {//抵扣金额超过200的情况
                sumMoney = 200;//最大抵扣星币
                
                if (coins  >= 200) {//星币抵扣数大于最大抵扣星币数 就等于最大抵扣星币数200
                    coninsStar = 200;
                }else{
                    coninsStar = coins;
                }
                
                
            }else{//抵扣金额小于课程
                
                if (coins > sum *0.05) {//星币抵扣数大于最大可抵扣的星币数时，给个提示
                    
                    
                    return [self createAlertViewWithTitle:nil message:@"星币抵扣数不能大于最大可抵扣的星币数" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
                    
                }else{
                    coninsStar = coins;
                    sumMoney = sum *0.05;
                    
                    
                    
                }
                
                
                
                
            }
            
            
            
            NSString *tearchs;
            
            if (self.isUpTeach) {
                
                tearchs = [self.dictCode valueForKey:@"teacherId"];
                
            }else{
                
                tearchs = self.tearchIds;
                
            }
            
            NSString *provinceid;
            NSString *city;
            NSString *areaid;
            
            if (self.isSSS) {
                provinceid = [NSString stringWithFormat:@"%@",self.provinceNumber];
                city = [NSString stringWithFormat:@"%@",self.cityNumber];
                areaid = [NSString stringWithFormat:@"%@",self.areaNumber];
                
            }else{
                 provinceid = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"provinceid"]];
                 city = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"cityid"]];
                areaid = [NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"areaid"]];
                
            }
            
       
            
            
            
            
            
            
            [self uid:tearchs limitNum:self.countTextField.text areaid:areaid?areaid:@"" provinceid:provinceid endTime:[NSString stringWithFormat:@"%@:%@",self.fourName.text,@"00"] type:@"10" smallCategoryIdString:categoryID cityid:city courseCategoryId:self.bigID templateId:self.ID startTime:[NSString stringWithFormat:@"%@:%@",self.threeName.text,@"00"] classroom:self.classRoomTextField.text price:[NSString stringWithFormat:@"%.2f",sum] coins:[NSString stringWithFormat:@"%ld",(long)coninsStar] address:self.streetTextField.text lessonTime: self.fiveName.text description:self.couseInTextView.text name:self.couseNameStr courseCount:self.timeTextField.text elementIds:userId commonLessonId:self.lessionId showPrice:self.displayPriceTextField.text?:@"0"];
            
            
        }else{
            [self createAlertViewWithTitle:nil message:@"请选择要素" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
        }
        
        
        
    }else{
        
        double coins = [self.starTextField.text doubleValue];
        double sum = [self.freeTextField.text doubleValue];
        
        double sumMoney = 0;
        double coninsStar = 0;
        if (sum *0.05  >= 200) {//抵扣金额超过200的情况
            sumMoney = 200;//最大抵扣星币
            
            if (coins  >= 200) {//星币抵扣数大于最大抵扣星币数 就等于最大抵扣星币数200
                coninsStar = 200;
            }else{
                coninsStar = coins;
            }
            
            
        }else{//抵扣金额小于课程
            
            if (coins > sum *0.05) {//星币抵扣数大于最大可抵扣的星币数时，给个提示
                
                
                return [self createAlertViewWithTitle:nil message:@"星币抵扣数不能大于最大可抵扣的星币数" preferredStyle:(UIAlertControllerStyleAlert) disapperaTime:1 andDis:nil];
                
            }else{
                coninsStar = coins;
                sumMoney = sum *0.05;
                
                
                
            }
            
            
            
            
        }
        
        
        
        NSString *tearchs;
        
        if (self.isUpTeach) {
            
            tearchs = [self.dictCode valueForKey:@"teacherId"];
            
        }else{
            
            tearchs = self.tearchIds;
            
        }
        
        
        
        
        
        [self uid:tearchs limitNum:self.countTextField.text areaid:[NSString stringWithFormat:@"%@",self.areaNumber] provinceid:[NSString stringWithFormat:@"%@",self.provinceNumber] endTime:[NSString stringWithFormat:@"%@:%@",self.fourName.text,@"00"] type:@"10" smallCategoryIdString:categoryID cityid:[NSString stringWithFormat:@"%@",self.cityNumber] courseCategoryId:self.bigID templateId:self.ID startTime:[NSString stringWithFormat:@"%@:%@",self.threeName.text,@"00"] classroom:self.classRoomTextField.text price:[NSString stringWithFormat:@"%.2f",sum] coins:[NSString stringWithFormat:@"%ld",(long)coninsStar] address:self.streetTextField.text lessonTime: self.fiveName.text description:self.couseInTextView.text name:self.couseNameStr courseCount:self.timeTextField.text elementIds:userId commonLessonId:self.lessionId showPrice:self.displayPriceTextField.text?:@"0"];
        
        
        
    }
    
    
    
    
}



- (void)uid:(NSString *)uid limitNum:(NSString *)limitNum areaid:(NSString *)areaid provinceid:(NSString *)provinceid endTime:(NSString *)endTime type:(NSString *)type smallCategoryIdString:(NSString *)smallCategoryIdString cityid:(NSString *)cityid courseCategoryId:(NSString *)courseCategoryId templateId:(NSString *)templateId startTime:(NSString *)startTime classroom:(NSString *)classroom price:(NSString *)price coins:(NSString *)coins address:(NSString *)address lessonTime:(NSString *)lessonTime description:(NSString *)description name:(NSString *)name courseCount:(NSString *)courseCount elementIds:(NSString *)elementIds commonLessonId:(NSString *)commonLessonId showPrice:(NSString *)showPrice{
    
    
    //limitNum=20 | areaid=440306 | provinceid=440000 | endTime=2017-12-03 15:47:00 | type=10 | smallCategoryIdString= | cityid=440300 | courseCategoryId=3 | templateId=38 | id=853 | startTime=2017-12-01 15:47:00 | classroom=406 | price=0.01 | coins=0 | address=华丰裕安大厦 | lessonTime=2017-12-01 15:47:00 | description=简介 | name=三好小当家之幸福的味道(加强课) | courseCount=5 | action=updateLesson
    
    
    //    http://192.168.0.113:8080/StarShine/ys/lesson.do?action=updateLesson&limitNum=20&areaid=440306&provinceid=440000&endTime=2017-12-03 15:47:00&type=10&smallCategoryIdString=&cityid=440300&courseCategoryId=3&templateId=38&id=853&startTime=2017-12-01 15:47:00&classroom=406&price=0.01&coins=0&address=华丰裕安大厦&lessonTime=2017-12-01 15:47:00&description=简介&name=三好小当家之幸福的味道(加强课)&courseCount=5&reinforceCategoryId=12
    
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    if (self.isUpTow) {
        //        url = [NSString stringWithFormat:@"lesson.do?action=updateLesson&limitNum=%@&areaid=%@&provinceid=%@&endTime=%@&type=%@&smallCategoryIdString=%@&cityid=%@&courseCategoryId=%@&templateId=%@&id=%@&startTime=%@&classroom=%@&price=%@&coins=%@&address=%@&lessonTime=%@&description=%@&name=%@&courseCount=%@&reinforceCategoryId=%@",limitNum,areaid,provinceid,endTime,type,smallCategoryIdString,cityid,courseCategoryId,templateId,[NSString stringWithFormat:@"%@",[self.dictCode valueForKey:@"id"]],startTime,classroom,price,coins,address,lessonTime,description,name,courseCount,[NSString stringWithFormat:@"%@",self.strongBigID]];
        //
        
        
        [params setValue:@"updateLesson" forKey:@"action"];
        [params setValue:limitNum forKey:@"limitNum"];
        [params setValue:areaid forKey:@"areaid"];
        [params setValue:provinceid forKey:@"provinceid"];
        [params setValue:endTime forKey:@"endTime"];
        [params setValue:type forKey:@"type"];
        [params setValue:smallCategoryIdString forKey:@"smallCategoryIdString"];
        [params setValue:cityid forKey:@"cityid"];
        [params setValue:courseCategoryId forKey:@"courseCategoryId"];
        [params setValue:templateId forKey:@"templateId"];
        [params setValue:[self.dictCode valueForKey:@"id"] forKey:@"id"];
        [params setValue:startTime forKey:@"startTime"];
        [params setValue:classroom forKey:@"classroom"];
        [params setValue:price forKey:@"price"];
        [params setValue:coins forKey:@"coins"];
        [params setValue:address forKey:@"address"];
        [params setValue:lessonTime forKey:@"lessonTime"];
        [params setValue:description forKey:@"description"];
        [params setValue:name forKey:@"name"];
        [params setValue:courseCount forKey:@"courseCount"];
        [params setValue:self.strongBigID forKey:@"reinforceCategoryId"];
        [params setValue:self.displayPriceTextField.text  forKey:@"showPrice"];
        
        
        
        
        
        
    }else{
        
        
        
        
        [params setValue:@"saveLesson2" forKey:@"action"];
        
        [params setValue:@"1" forKey:@"sellStatus"];
        [params  setValue:uid forKey:@"uid"];
        [params setValue:limitNum forKey:@"limitNum"];
        [params setValue:areaid forKey:@"areaid"];
        [params setValue:provinceid forKey:@"provinceid"];
        [params setValue:endTime forKey:@"endTime"];
        [params setValue:type forKey:@"type"];
        [params setValue:smallCategoryIdString forKey:@"smallCategoryIdString"];
        [params setValue:cityid forKey:@"cityid"];
        [params setValue:courseCategoryId forKey:@"courseCategoryId"];
        [params setValue:templateId forKey:@"templateId"];
        [params setValue:startTime forKey:@"startTime"];
        [params setValue:classroom forKey:@"classroom"];
        [params setValue:price forKey:@"price"];
        [params setValue:coins forKey:@"coins"];
        [params setValue:address forKey:@"address"];
        [params setValue:lessonTime forKey:@"lessonTime"];
        [params setValue:description forKey:@"description"];
        
        [params setValue:name forKey:@"name"];
        [params setValue:courseCount forKey:@"courseCount"];
        [params setValue:elementIds forKey:@"elementIds"];
        [params setValue:commonLessonId forKey:@"commonLessonId"];
        
        [params setValue:self.strongBigID forKey:@"reinforceCategoryId"];
        [params setValue:@([self.displayPriceTextField.text integerValue]) forKey:@"showPrice"];
        
        
        
        
        
        
    }
    
    
    
    
    
    [NetManager Post:LLBaseURL(@"lesson.do") Auth:YES Params:params Success:^(id Obj) {
        
        
        if ([[Obj valueForKey:@"code"] integerValue] == 1000) {
            
            
            if (self.popBlock) {
                self.popBlock();
                
            }
            
            [self.navigationController popViewControllerAnimated:YES];
            
            
        }
        
        
        
        
    } Fail:^(NSError *Error) {
        NSLog(@"%@",Error);
        
    }];
    
    
    
    
    
    
}


- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    
    [self.PickView removeFromSuperview];
    
}



@end

